varying vec4 pos;
varying vec3 normal;
uniform sampler2D lightmap1;
uniform sampler2D lightmap2;
uniform sampler2D lightmap3;

const vec3 axisX = vec3(-0.40824,  0.707107,  0.57735);
const vec3 axisY = vec3(-0.40824,  -0.707107,  0.57735);
const vec3 axisZ = vec3(0.81650, 0.0, 0.57735);

void main()
{
  vec3 n = vec3(0.0,0.0,1.0);
  vec3 weight = vec3(dot(axisX,n), dot(axisY,n), dot(axisZ,n));
  vec3 rad = texture2D(lightmap1, gl_TexCoord[1].xy).xyz*weight.x + 
             texture2D(lightmap2, gl_TexCoord[1].xy).xyz*weight.y +
	     texture2D(lightmap3, gl_TexCoord[1].xy).xyz*weight.z; 
  vec3 color = rad;
  gl_FragColor = vec4(color,1.0);// + vec4(0.2,0.2,0.2,1.0);
}